Skip to content

Take over a volume in one Mount attempt and tear down after a preempt - #13

Merged
Jaben merged 2 commits into
developfrom
fix/preempt-handoff
Nov 25, 2026
Merged

Jaben merged 2 commits into
developfrom
fix/preempt-handoff

Conversation

@Jaben

@Jaben Jaben commented Nov 25, 2026

Copy link
Copy Markdown
Member

Fixes two problems a start-first cross-node update hit on dockerprime under 1.4.2. Mount gave up after 30 s per attempt, so the task failed and swarm paused or rolled back the update before the 90 s grace ran out; it now waits until 15 s short of its own 110 s deadline, so the default grace is waited out and the takeover done in one attempt. The losing node's teardown looped forever because InUseByContainer stat'ed a mountpoint whose filesystem the preempt had shut down (EIO); the device now comes from mountinfo.

Tested as 1.4.3-dev on docker02/03: takeover at 90 s in one attempt, update completed, all 467 acked writes present, docker02 tore down 17 s after the preempt with no stale maps. Swarm still briefly starts a replacement for the old task when it dies on EIO (about 12 s of two copies on the new node, same mount); that's swarm's restart logic, not addressed here. Local CI gate (gofmt, vet, race tests, govulncheck, golangci-lint v2.15.0) is green.

A start-first update that moves a volume to another node failed: each Mount gave up after 30 s with "still attached", which fails the task, and swarm paused or rolled back the update before the 90 s grace was up. A Mount now waits for the other host until 15 s short of its own deadline, so the default grace is waited out, the holder preempted and the volume attached in one attempt. A longer grace still fails and retries as before.

On the node that lost the volume the teardown never ran. The in-use check stat'ed the mountpoint, which fails with EIO on the filesystem the preempt shut down, and the linger retried every 15 s forever, leaving the mount and an empty multipath map. The device number now comes from mountinfo.

On dockerprime both held: the move took over at 90 s in a single attempt, the update completed, every acked write was present, and the old node tore down 17 s after the preempt.
Copilot AI balanced review requested due to automatic review settings November 25, 2026 02:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Polling sleeps and array queries can overrun the cutoff and consume the 15-second attachment reserve, leaving insufficient time to complete takeover in one attempt.

1 open issue
What changed in this PR

This PR improves volume takeover and post-preemption cleanup in the Docker FlashArray volume plugin, aiming to complete the default grace period within one Mount attempt.

Changes:

  • Extends ownership polling toward the Mount deadline while reserving time for attachment.
  • Uses mountinfo instead of filesystem stat to identify devices after preemption.
  • Adds regression tests and updates timeout and takeover documentation.
File Description
README.md Documents longer waits and start-first update behavior.
internal/​mounter/​mounter.go Gets device identity from mountinfo to avoid post-preemption stat failures.
internal/​mounter/​mounter_test.go Tests mountinfo-based container-use checks and absent mounts.
internal/​driver/​driver.go Uses the full Mount budget and introduces an attachment reserve.
internal/​driver/​driver_test.go Tests single-attempt grace waiting and the polling cutoff.
internal/​config/​config.go Removes the outdated 30-second wait reference from a comment.

Review effort: Balanced

Comment thread internal/driver/driver.go Outdated
Comment on lines 1351 to 1354
if dl, ok := ctx.Deadline(); ok {
wait = min(wait, time.Until(dl)-attachReserve)
}
deadline := time.Now().Add(wait)
The cutoff only decided whether another poll started; the sleep and the array query still ran on the Mount's deadline, so a slow answer near the cutoff could use up the time kept to attach. They now run on a deadline at the cutoff. A poll cut off mid-query fails the attempt instead of releasing or preempting on an answer it never got, and a cancelled Mount returns at once.
@Jaben
Jaben merged commit bb8d7eb into develop Nov 25, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants